package com.entor.springboot201912.model;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Student implements Serializable {
    private static final long serialVersionUID = 20191212181208L;
    private Integer id;
    private String name;
    private String password;
    private String sex;
    private Date birthday;
    private String bir;
    private String address;
    private String studentNo;//数据库的字段是student_no
    private Integer age;
    private Double weight;
    private Double height;
    //alt+insert
    public Student() {}
    public Student(String name, String password, String sex, Date birthday, String address, String studentNo, Integer age, double weight, double height) {
        this.name = name;
        this.password = password;
        this.sex = sex;
        this.birthday = birthday;
        this.address = address;
        this.studentNo = studentNo;
        this.age = age;
        this.weight = weight;
        this.height = height;
    }

    public String getBir() {
        if(this.birthday!=null){
            bir = new SimpleDateFormat("yyyy-MM-dd").format(this.birthday);
        }
        return bir;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getStudentNo() {
        return studentNo;
    }

    public void setStudentNo(String studentNo) {
        this.studentNo = studentNo;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Double getWeight() {
        return weight;
    }

    public void setWeight(Double weight) {
        this.weight = weight;
    }

    public Double getHeight() {
        return height;
    }

    public void setHeight(Double height) {
        this.height = height;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", sex='" + sex + '\'' +
                ", birthday=" + birthday +
                ", address='" + address + '\'' +
                ", studentNo='" + studentNo + '\'' +
                ", age=" + age +
                ", weight=" + weight +
                ", height=" + height +
                '}';
    }
}
